package com.carease.view.seller;

import com.carease.view.Index;
import com.carease.view.Login;
import com.carease.view.Register;

import java.awt.*;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Main extends JFrame {

	private JPanel contentPane;

	private CardLayout cardLayout = new CardLayout();



	/**
	 * Create the frame.
	 */
	public Main(int seller_id) {
		setTitle("\u5356\u5BB6\u7AEF");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 843, 553);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JPanel panel = new JPanel();
		panel.setBounds(10, 84, 807, 420);
		contentPane.add(panel);
		panel.setLayout(cardLayout);


		panel.add(new Index(), "index");
		panel.add(new MyOrder(seller_id),"myOrder");
		panel.add(new Cars(seller_id),"cars");

		
		JButton jb_index = new JButton("\u9996\u9875");
		jb_index.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cardLayout.show(panel,"index");
			}
		});
		jb_index.setBounds(70, 36, 93, 23);
		contentPane.add(jb_index);
		
		JButton jb_info = new JButton("\u4E2A\u4EBA\u4FE1\u606F");
		jb_info.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new Register(seller_id).setVisible(true);
			}
		});
		jb_info.setBounds(197, 36, 93, 23);
		contentPane.add(jb_info);
		
		JButton jb_products = new JButton("\u4EA7\u54C1\u5217\u8868");
		jb_products.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cardLayout.show(panel,"cars");
			}
		});
		jb_products.setBounds(321, 36, 93, 23);
		contentPane.add(jb_products);
		
		JButton jb_my_order = new JButton("\u6211\u7684\u8BA2\u5355");
		jb_my_order.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cardLayout.show(panel,"myOrder");

			}
		});
		jb_my_order.setBounds(451, 36, 93, 23);
		contentPane.add(jb_my_order);
		
		JButton jb_exit = new JButton("\u9000\u51FA");
		jb_exit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
				new Login().setVisible(true);
			}
		});
		jb_exit.setBounds(697, 36, 93, 23);
		contentPane.add(jb_exit);
	}

}
